/************************************************
 * File: app.h
 *
 * Description: App layer.
 * 		Sending and receiving with formatted commands.
 * 		Deal with user's variety request. Include:
 * 		1. Tx Data
 * 		2. Query Address
 * 		3. Query RF Power
 * 		4. Query Stack's Statistic Information
 * 		5. Set RF Power
 * 		6. Reset Stack's Statistic Information
 * 		Test frames see "test_frames.txt"
 *
 * Date: 2010-05-21
 ************************************************/
#ifndef APP_H
#define APP_H

/************************************************
 	**	External Functions	**
 ***********************************************/
extern void app_init();
extern BOOL app_frm_avail();
extern void app_frm_parse();

// The extra length for 'len' byte and 'checksum'  byte.
#define EXTRA_LEN_CHECKSUM 2

#define CMD_DELIMETER		0X7E
#define CMD_TYPE_TX_DATA	0x10	// send data from pc/arm to cc2430
#define CMD_TYPE_RX_DATA	0x90	// send data from 2430 to pc/arm
#define CMD_TYPE_SET_PARA	0x08	// set parameters from pc/arm
#define CMD_TYPE_GET_PARA	0x09	//  pc/arm is querying for para value
#define CMD_TYPE_RET_PARA	0x8B	// return parameters to pc/arm
#define CMD_TYPE_GET_STATISTIC	0x70	// pc/arm to cc2430
#define CMD_TYPE_RET_STATISTIC	0x71	//  cc2430 return STATISTIC info to pc/arm
#define CMD_TYPE_CLR_STATISTIC	0X72	// reset the statistic info
#define CMD_TYPE_GET_CPSR	0x73	// Get Current Pointer Status.
#define CMD_TYPE_RET_CPSR	0x74	// Ret Current Pointer Status.


#define PARA_TYPE_TXPOWER	0x01
#define PARA_TYPE_MYSADDR	0x02	// my short addr, 2 bytes
#define PARA_TYPE_RSSI		0x03	// received signal strength indicator
#define PARA_TYPE_TEMPERATURE	0x04	// temperature

#define PARA_TYPE_VERSION	0X10	// firmware version	TODO: not implemented
#define PARA_TYPE_BAUDRATE	0x20

#endif
